package com.lingshu.app.model.structure;

import androidx.databinding.Bindable;

import com.lingshu.app.BR;

/**
 * 颈动脉结构化数据
 */
public class CarotidStructureData extends StructureData {
    private Integer exceptionalCarotidR = 0;
    private Integer exceptionalCarotidL = 0;
    private Double innerThicknessCarotidR = 0.8D;
    private Double innerThicknessCarotidL = 0.8D;
    private Integer innerTypeCarotidR = 2;
    private Integer innerTypeCarotidL = 2;
    private Integer typeCarotidR;
    private Integer typeCarotidL;
    private Integer locationCarotidR;
    private Integer locationCarotidL;
    private Double thicknessCarotidR = 0D;
    private Double thicknessCarotidL = 0D;
    private Integer echoCarotidR;
    private Integer echoCarotidL;
    private Integer areaRateCarotidR;
    private Integer areaRateCarotidL;
    private Integer areaRateLevelCarotidR;
    private Integer areaRateLevelCarotidL;
    private Boolean enableCarotidR = false;
    private Boolean enableCarotidL = false;
    private Boolean enableCarotidInnerTypeR = true;
    private Boolean enableCarotidInnerTypeL = true;

    @Bindable
    public Integer getExceptionalCarotidR() {
        return exceptionalCarotidR;
    }

    public void setExceptionalCarotidR(Integer exceptionalCarotidR) {
        this.exceptionalCarotidR = exceptionalCarotidR;
        updateOtherProperty(true);
        notifyPropertyChanged(BR.enableCarotidR);
        notifyPropertyChanged(BR.enableCarotidInnerTypeR);
        notifyPropertyChanged(BR.innerThicknessCarotidR);
        notifyPropertyChanged(BR.innerTypeCarotidR);
        notifyPropertyChanged(BR.typeCarotidR);
        notifyPropertyChanged(BR.locationCarotidR);
        notifyPropertyChanged(BR.thicknessCarotidR);
        notifyPropertyChanged(BR.echoCarotidR);
        notifyPropertyChanged(BR.areaRateCarotidR);
        notifyPropertyChanged(BR.areaRateLevelCarotidR);
    }

    @Bindable
    public Integer getExceptionalCarotidL() {
        return exceptionalCarotidL;
    }

    public void setExceptionalCarotidL(Integer exceptionalCarotidL) {
        this.exceptionalCarotidL = exceptionalCarotidL;
        updateOtherProperty(false);
        notifyPropertyChanged(BR.enableCarotidL);
        notifyPropertyChanged(BR.enableCarotidInnerTypeL);
        notifyPropertyChanged(BR.innerThicknessCarotidL);
        notifyPropertyChanged(BR.innerTypeCarotidL);
        notifyPropertyChanged(BR.typeCarotidL);
        notifyPropertyChanged(BR.locationCarotidL);
        notifyPropertyChanged(BR.thicknessCarotidL);
        notifyPropertyChanged(BR.echoCarotidL);
        notifyPropertyChanged(BR.areaRateCarotidL);
        notifyPropertyChanged(BR.areaRateLevelCarotidL);
    }

    @Bindable
    public Double getInnerThicknessCarotidR() {
        return innerThicknessCarotidR;
    }

    public void setInnerThicknessCarotidR(Double innerThicknessCarotidR) {
        this.innerThicknessCarotidR = innerThicknessCarotidR;
    }

    @Bindable
    public Double getInnerThicknessCarotidL() {
        return innerThicknessCarotidL;
    }

    public void setInnerThicknessCarotidL(Double innerThicknessCarotidL) {
        this.innerThicknessCarotidL = innerThicknessCarotidL;
    }

    @Bindable
    public Integer getInnerTypeCarotidR() {
        return innerTypeCarotidR;
    }

    public void setInnerTypeCarotidR(Integer innerTypeCarotidR) {
        this.innerTypeCarotidR = innerTypeCarotidR;
    }

    @Bindable
    public Integer getInnerTypeCarotidL() {
        return innerTypeCarotidL;
    }

    public void setInnerTypeCarotidL(Integer innerTypeCarotidL) {
        this.innerTypeCarotidL = innerTypeCarotidL;
    }

    @Bindable
    public Integer getTypeCarotidR() {
        return typeCarotidR;
    }

    public void setTypeCarotidR(Integer typeCarotidR) {
        this.typeCarotidR = typeCarotidR;
    }

    @Bindable
    public Integer getTypeCarotidL() {
        return typeCarotidL;
    }

    public void setTypeCarotidL(Integer typeCarotidL) {
        this.typeCarotidL = typeCarotidL;
    }

    @Bindable
    public Integer getLocationCarotidR() {
        return locationCarotidR;
    }

    public void setLocationCarotidR(Integer locationCarotidR) {
        this.locationCarotidR = locationCarotidR;
    }

    @Bindable
    public Integer getLocationCarotidL() {
        return locationCarotidL;
    }

    public void setLocationCarotidL(Integer locationCarotidL) {
        this.locationCarotidL = locationCarotidL;
    }

    @Bindable
    public Double getThicknessCarotidR() {
        return thicknessCarotidR;
    }

    public void setThicknessCarotidR(Double thicknessCarotidR) {
        this.thicknessCarotidR = thicknessCarotidR;
    }

    @Bindable
    public Double getThicknessCarotidL() {
        return thicknessCarotidL;
    }

    public void setThicknessCarotidL(Double thicknessCarotidL) {
        this.thicknessCarotidL = thicknessCarotidL;
    }

    @Bindable
    public Integer getEchoCarotidR() {
        return echoCarotidR;
    }

    public void setEchoCarotidR(Integer echoCarotidR) {
        this.echoCarotidR = echoCarotidR;
    }

    @Bindable
    public Integer getEchoCarotidL() {
        return echoCarotidL;
    }

    public void setEchoCarotidL(Integer echoCarotidL) {
        this.echoCarotidL = echoCarotidL;
    }

    @Bindable
    public Integer getAreaRateCarotidR() {
        return areaRateCarotidR;
    }

    public void setAreaRateCarotidR(Integer areaRateCarotidR) {
        this.areaRateCarotidR = areaRateCarotidR;
    }

    @Bindable
    public Integer getAreaRateCarotidL() {
        return areaRateCarotidL;
    }

    public void setAreaRateCarotidL(Integer areaRateCarotidL) {
        this.areaRateCarotidL = areaRateCarotidL;
    }

    @Bindable
    public Integer getAreaRateLevelCarotidR() {
        return areaRateLevelCarotidR;
    }

    public void setAreaRateLevelCarotidR(Integer areaRateLevelCarotidR) {
        this.areaRateLevelCarotidR = areaRateLevelCarotidR;
    }

    @Bindable
    public Integer getAreaRateLevelCarotidL() {
        return areaRateLevelCarotidL;
    }

    public void setAreaRateLevelCarotidL(Integer areaRateLevelCarotidL) {
        this.areaRateLevelCarotidL = areaRateLevelCarotidL;
    }

    @Bindable
    public Boolean getEnableCarotidR() {
        return enableCarotidR;
    }

    public void setEnableCarotidR(Boolean enableCarotidR) {
        this.enableCarotidR = enableCarotidR;
    }

    @Bindable
    public Boolean getEnableCarotidL() {
        return enableCarotidL;
    }

    public void setEnableCarotidL(Boolean enableCarotidL) {
        this.enableCarotidL = enableCarotidL;
    }

    @Bindable
    public Boolean getEnableCarotidInnerTypeR() {
        return enableCarotidInnerTypeR;
    }

    public void setEnableCarotidInnerTypeR(boolean enableCarotidInnerTypeR) {
        this.enableCarotidInnerTypeR = enableCarotidInnerTypeR;
    }

    @Bindable
    public Boolean getEnableCarotidInnerTypeL() {
        return enableCarotidInnerTypeL;
    }

    public void setEnableCarotidInnerTypeL(boolean enableCarotidInnerTypeL) {
        this.enableCarotidInnerTypeL = enableCarotidInnerTypeL;
    }

    private void updateOtherProperty(boolean isRight) {
        if (isRight) {
            //右侧
            if (getExceptionalCarotidR() < 2 && getExceptionalCarotidR() != -2) {
                setEnableCarotidR(false);
                setEnableCarotidInnerTypeR(true);
                if (getExceptionalCarotidR() == 0) {
                    setInnerThicknessCarotidR(0.8D);
                    setInnerTypeCarotidR(2);
                } else {
                    setInnerThicknessCarotidR(1.2D);
                    setInnerTypeCarotidR(3);
                }
                setTypeCarotidR(0);
                setLocationCarotidR(0);
                setThicknessCarotidR(0.0D);
                setEchoCarotidR(0);
                setAreaRateCarotidR(0);
                setAreaRateLevelCarotidR(0);
            } else if (getExceptionalCarotidR() >= 2) {
                setEnableCarotidR(true);
                setEnableCarotidInnerTypeR(true);
                setInnerThicknessCarotidR(1.0D);
                setInnerTypeCarotidR(3);
                setTypeCarotidR(1);
                setLocationCarotidR(4);
                setThicknessCarotidR(1.5D);
                setEchoCarotidR(2);
                setAreaRateCarotidR(0);
                setAreaRateLevelCarotidR(1);
            } else {
                setEnableCarotidR(false);
                setEnableCarotidInnerTypeR(false);
                setInnerThicknessCarotidR(0.0D);
                setInnerTypeCarotidR(0);
                setTypeCarotidR(0);
                setLocationCarotidR(0);
                setThicknessCarotidR(0.0D);
                setEchoCarotidR(0);
                setAreaRateCarotidR(0);
                setAreaRateLevelCarotidR(0);
            }
        } else {
            //左侧
            if (getExceptionalCarotidL() < 2 && getExceptionalCarotidL() != -2) {
                setEnableCarotidL(false);
                setEnableCarotidInnerTypeL(true);
                if (getExceptionalCarotidL() == 0) {
                    setInnerThicknessCarotidL(0.8D);
                    setInnerTypeCarotidL(2);
                } else {
                    setInnerThicknessCarotidL(1.2D);
                    setInnerTypeCarotidL(3);
                }
                setTypeCarotidL(0);
                setLocationCarotidL(0);
                setThicknessCarotidL(0.0D);
                setEchoCarotidL(0);
                setAreaRateCarotidL(0);
                setAreaRateLevelCarotidL(0);
            } else if (getExceptionalCarotidL() >= 2) {
                setEnableCarotidL(true);
                setEnableCarotidInnerTypeL(true);
                setInnerThicknessCarotidL(1.0D);
                setInnerTypeCarotidL(3);
                setTypeCarotidL(1);
                setLocationCarotidL(4);
                setThicknessCarotidL(1.5D);
                setEchoCarotidL(2);
                setAreaRateCarotidL(0);
                setAreaRateLevelCarotidL(1);
            } else {
                setEnableCarotidL(false);
                setEnableCarotidInnerTypeL(false);
                setInnerThicknessCarotidL(0.0D);
                setInnerTypeCarotidL(0);
                setTypeCarotidL(0);
                setLocationCarotidL(0);
                setThicknessCarotidL(0.0D);
                setEchoCarotidL(0);
                setAreaRateCarotidL(0);
                setAreaRateLevelCarotidL(0);
            }
        }
    }
}
